import Vue from 'vue'
import Vuex from 'vuex'

import { api, $api } from './api'

var remote = false
const HOST=remote?"http://boc.nmict.cn:8088":"http://localhost:8088"


Vue.use(Vuex)

const main = {
  state: {
    
  },
  mutations: {
    
  },
  actions: {
    orderAdd(context, payload) {
      return api(`${HOST}/api/order`,{type:'post',params:payload});
    },
    comps(context, payload) {
      return api(`${HOST}/api/comps`);
    },
    numberPool(context, payload) {
      return api(`${HOST}/api/number-pool`,{params:payload});
    },
    smallNumberPool(context, payload) {
      return api(`${HOST}/api/small-number-pool`,{params:payload});
    },
    numberUsed(context, payload) {
      return api(`${HOST}/api/number-used`,{type:'post',params:payload});
    },
    orderSearch(context,payload){
      return api(`${HOST}/api/order-search`,{params:payload})
    }
  }
}



const store = new Vuex.Store({
  modules: {
    main
  }
})

export default store